#ifndef MOVING_AVERAGE_FILTER_H
#define MOVING_AVERAGE_FILTER_H

class MovingAverageFilter {
public:
    // 构造函数：传入窗口大小
    MovingAverageFilter(int windowSize);
    ~MovingAverageFilter();

    // 输入新数据并返回滤波结果
    float update(float newValue);

    // 重置滤波器
    void reset();

private:
    float* buffer;
    int windowSize;
    int index;
    int count;
    float sum;
};

#endif // MOVING_AVERAGE_FILTER_H
